package com.vcourse.service.statistics.controller;


import com.vcourse.commons.result.R;
import com.vcourse.service.statistics.entity.Daily;
import com.vcourse.service.statistics.service.DailyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author Zengsh123
 * @since 2020-06-14
 */
@Api("网站统计日数据")
@Slf4j
@RestController
@RequestMapping("/admin/statistics/daily")
public class DailyController {
    @Resource
    private DailyService dailyService;

    @ApiOperation("统计指定时间内网站数据")
    @GetMapping("get/{start}/{end}")
    public R create(@ApiParam("开始日期") @PathVariable String start,
                    @ApiParam("截止日期") @PathVariable String end){
        Map<String, Object> map = dailyService.getDailyData(start, end);
        return R.ok().data(map);
    }
}

